version=$(bun  -v)
version_app='0.1'
name_app='myapp'

# https://bun.sh/docs/bundler/executables#supported-targets

# bun build --compile  --minify

# linux
# Note: the default architecture is x64 if no architecture is specified.
bun build --compile --target=bun-linux-x64 ./index.ts --outfile ./out/$name_app-$version_app-linux-x64-v$version
bun build --compile --target=bun-linux-arm64 ./index.ts --outfile ./out/$name_app-$version_app-linux-arm64-v$version

# windows
bun build --compile --target=bun-windows-x64 ./index.ts --outfile ./out/$name_app-$version_app-windows-x64-v$version
# To support CPUs from before 2013, use the baseline version (nehalem)
bun build --compile --target=bun-windows-x64-baseline ./index.ts --outfile ./out/$name_app-$version_app-windows-x64-baseline-v$version
# To explicitly only support CPUs from 2013 and later, use the modern version (haswell)
bun build --compile --target=bun-windows-x64-modern ./index.ts --outfile ./out/$name_app-$version_app-windows-x64-modern-v$version

# macOS
# note: if no .exe extension is provided, Bun will automatically add it for Windows executables
bun build --compile --target=bun-darwin-arm64 ./index.ts --outfile ./out/$name_app-$version_app-darwin-arm64-v$version

bun build --compile --target=bun-darwin-x64 ./index.ts --outfile ./out/$name_app-$version_app-darwin-x64-v$version